/*
 * XML Type:  digitalObjectType
 * Namespace: info:fedora/fedora-system:def/foxml#
 * Java type: fedora.fedoraSystemDef.foxml.DigitalObjectType
 *
 * Automatically generated - do not modify.
 */
package fedora.fedoraSystemDef.foxml.impl;
/**
 * An XML digitalObjectType(@info:fedora/fedora-system:def/foxml#).
 *
 * This is a complex type.
 */
public class DigitalObjectTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements fedora.fedoraSystemDef.foxml.DigitalObjectType
{
    private static final long serialVersionUID = 1L;
    
    public DigitalObjectTypeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName OBJECTPROPERTIES$0 = 
        new javax.xml.namespace.QName("info:fedora/fedora-system:def/foxml#", "objectProperties");
    private static final javax.xml.namespace.QName DATASTREAM$2 = 
        new javax.xml.namespace.QName("info:fedora/fedora-system:def/foxml#", "datastream");
    private static final javax.xml.namespace.QName VERSION$4 = 
        new javax.xml.namespace.QName("", "VERSION");
    private static final javax.xml.namespace.QName PID$6 = 
        new javax.xml.namespace.QName("", "PID");
    private static final javax.xml.namespace.QName FEDORAURI$8 = 
        new javax.xml.namespace.QName("", "FEDORA_URI");
    
    
    /**
     * Gets the "objectProperties" element
     */
    public fedora.fedoraSystemDef.foxml.ObjectPropertiesType getObjectProperties()
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.ObjectPropertiesType target = null;
            target = (fedora.fedoraSystemDef.foxml.ObjectPropertiesType)get_store().find_element_user(OBJECTPROPERTIES$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "objectProperties" element
     */
    public void setObjectProperties(fedora.fedoraSystemDef.foxml.ObjectPropertiesType objectProperties)
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.ObjectPropertiesType target = null;
            target = (fedora.fedoraSystemDef.foxml.ObjectPropertiesType)get_store().find_element_user(OBJECTPROPERTIES$0, 0);
            if (target == null)
            {
                target = (fedora.fedoraSystemDef.foxml.ObjectPropertiesType)get_store().add_element_user(OBJECTPROPERTIES$0);
            }
            target.set(objectProperties);
        }
    }
    
    /**
     * Appends and returns a new empty "objectProperties" element
     */
    public fedora.fedoraSystemDef.foxml.ObjectPropertiesType addNewObjectProperties()
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.ObjectPropertiesType target = null;
            target = (fedora.fedoraSystemDef.foxml.ObjectPropertiesType)get_store().add_element_user(OBJECTPROPERTIES$0);
            return target;
        }
    }
    
    /**
     * Gets array of all "datastream" elements
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
	public fedora.fedoraSystemDef.foxml.DatastreamType[] getDatastreamArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(DATASTREAM$2, targetList);
            fedora.fedoraSystemDef.foxml.DatastreamType[] result = new fedora.fedoraSystemDef.foxml.DatastreamType[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "datastream" element
     */
    public fedora.fedoraSystemDef.foxml.DatastreamType getDatastreamArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.DatastreamType target = null;
            target = (fedora.fedoraSystemDef.foxml.DatastreamType)get_store().find_element_user(DATASTREAM$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "datastream" element
     */
    public int sizeOfDatastreamArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(DATASTREAM$2);
        }
    }
    
    /**
     * Sets array of all "datastream" element
     */
    public void setDatastreamArray(fedora.fedoraSystemDef.foxml.DatastreamType[] datastreamArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(datastreamArray, DATASTREAM$2);
        }
    }
    
    /**
     * Sets ith "datastream" element
     */
    public void setDatastreamArray(int i, fedora.fedoraSystemDef.foxml.DatastreamType datastream)
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.DatastreamType target = null;
            target = (fedora.fedoraSystemDef.foxml.DatastreamType)get_store().find_element_user(DATASTREAM$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(datastream);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "datastream" element
     */
    public fedora.fedoraSystemDef.foxml.DatastreamType insertNewDatastream(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.DatastreamType target = null;
            target = (fedora.fedoraSystemDef.foxml.DatastreamType)get_store().insert_element_user(DATASTREAM$2, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "datastream" element
     */
    public fedora.fedoraSystemDef.foxml.DatastreamType addNewDatastream()
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.DatastreamType target = null;
            target = (fedora.fedoraSystemDef.foxml.DatastreamType)get_store().add_element_user(DATASTREAM$2);
            return target;
        }
    }
    
    /**
     * Removes the ith "datastream" element
     */
    public void removeDatastream(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(DATASTREAM$2, i);
        }
    }
    
    /**
     * Gets the "VERSION" attribute
     */
    public fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION.Enum getVERSION()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(VERSION$4);
            if (target == null)
            {
                return null;
            }
            return (fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION.Enum)target.getEnumValue();
        }
    }
    
    /**
     * Gets (as xml) the "VERSION" attribute
     */
    public fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION xgetVERSION()
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION target = null;
            target = (fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION)get_store().find_attribute_user(VERSION$4);
            return target;
        }
    }
    
    /**
     * Sets the "VERSION" attribute
     */
    public void setVERSION(fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION.Enum version)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(VERSION$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(VERSION$4);
            }
            target.setEnumValue(version);
        }
    }
    
    /**
     * Sets (as xml) the "VERSION" attribute
     */
    public void xsetVERSION(fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION version)
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION target = null;
            target = (fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION)get_store().find_attribute_user(VERSION$4);
            if (target == null)
            {
                target = (fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION)get_store().add_attribute_user(VERSION$4);
            }
            target.set(version);
        }
    }
    
    /**
     * Gets the "PID" attribute
     */
    public java.lang.String getPID()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(PID$6);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "PID" attribute
     */
    public fedora.fedoraSystemDef.foxml.PidType xgetPID()
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.PidType target = null;
            target = (fedora.fedoraSystemDef.foxml.PidType)get_store().find_attribute_user(PID$6);
            return target;
        }
    }
    
    /**
     * True if has "PID" attribute
     */
    public boolean isSetPID()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(PID$6) != null;
        }
    }
    
    /**
     * Sets the "PID" attribute
     */
    public void setPID(java.lang.String pid)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(PID$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(PID$6);
            }
            target.setStringValue(pid);
        }
    }
    
    /**
     * Sets (as xml) the "PID" attribute
     */
    public void xsetPID(fedora.fedoraSystemDef.foxml.PidType pid)
    {
        synchronized (monitor())
        {
            check_orphaned();
            fedora.fedoraSystemDef.foxml.PidType target = null;
            target = (fedora.fedoraSystemDef.foxml.PidType)get_store().find_attribute_user(PID$6);
            if (target == null)
            {
                target = (fedora.fedoraSystemDef.foxml.PidType)get_store().add_attribute_user(PID$6);
            }
            target.set(pid);
        }
    }
    
    /**
     * Unsets the "PID" attribute
     */
    public void unsetPID()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(PID$6);
        }
    }
    
    /**
     * Gets the "FEDORA_URI" attribute
     */
    public java.lang.String getFEDORAURI()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(FEDORAURI$8);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "FEDORA_URI" attribute
     */
    public org.apache.xmlbeans.XmlAnyURI xgetFEDORAURI()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(FEDORAURI$8);
            return target;
        }
    }
    
    /**
     * True if has "FEDORA_URI" attribute
     */
    public boolean isSetFEDORAURI()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(FEDORAURI$8) != null;
        }
    }
    
    /**
     * Sets the "FEDORA_URI" attribute
     */
    public void setFEDORAURI(java.lang.String fedorauri)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(FEDORAURI$8);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(FEDORAURI$8);
            }
            target.setStringValue(fedorauri);
        }
    }
    
    /**
     * Sets (as xml) the "FEDORA_URI" attribute
     */
    public void xsetFEDORAURI(org.apache.xmlbeans.XmlAnyURI fedorauri)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(FEDORAURI$8);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlAnyURI)get_store().add_attribute_user(FEDORAURI$8);
            }
            target.set(fedorauri);
        }
    }
    
    /**
     * Unsets the "FEDORA_URI" attribute
     */
    public void unsetFEDORAURI()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(FEDORAURI$8);
        }
    }
    /**
     * An XML VERSION(@).
     *
     * This is an atomic type that is a restriction of fedora.fedoraSystemDef.foxml.DigitalObjectType$VERSION.
     */
    public static class VERSIONImpl extends org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx implements fedora.fedoraSystemDef.foxml.DigitalObjectType.VERSION
    {
        private static final long serialVersionUID = 1L;
        
        public VERSIONImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType, false);
        }
        
        protected VERSIONImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
        {
            super(sType, b);
        }
    }
}
